[<<Previous Entry]
[^^Up^^]
[Next Entry>>]
[Menu]
[About The Guide]
abort() Abort Process and Return Error
#include <process.h> Required only for declarations
#include <stdlib.h> Use either <process.h> or <stdlib.h>
void abort(void);
abort() terminates a calling process, prints the message "Abnormal
program termination" to 'stderr', exits with status code 3, and
returns control to the parent without flushing stream buffers.
Returns: Exit status 3; does not return to the calling process
-------------------------------- Example ---------------------------------
The following statements terminate the program if the file
"testfile.dat" cannot be opened:
#include <process.h> /* for 'abort' (also in <stdlib.h>) */
#include <stdio.h> /* for 'fprintf' */
main()
{
FILE *f;
if ((f = fopen("testfile.dat", "r")) == NULL) {
fprintf(stderr, "can't open testfile.dat\n");
abort();
}
}
See Also:
exit()
_exit()
This page created by ng2html v1.05, the Norton guide to HTML conversion utility.
Written by Dave Pearson